import { SET_CATEGORYLIST_STATE } from "../module_type"
import { reqCategoryList } from "@/api"
const state = {
  categoryList: [],
}
const mutations = {
  [SET_CATEGORYLIST_STATE](state, payload) {
    state.categoryList = payload.categoryList
  },
}
const actions = {
  async getCategory({ commit }) {
    const res = await reqCategoryList()
    // console.log(res)
    commit(SET_CATEGORYLIST_STATE, { categoryList: res })
  },
}
const getters = {}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
}
